package com.ruoyi.core.service.impl;

import java.util.Calendar;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.core.mapper.ShopMapper;
import com.ruoyi.core.domain.Shop;
import com.ruoyi.core.service.IShopService;
import com.ruoyi.common.core.text.Convert;

/**
 * 网点列表Service业务层处理
 * 
 * @author lgc
 * @date 2020-08-07
 */
@Service
public class ShopServiceImpl implements IShopService 
{
    @Autowired
    private ShopMapper shopMapper;

    /**
     * 查询网点列表
     * 
     * @param shopId 网点列表ID
     * @return 网点列表
     */
    @Override
    public Shop selectShopById(Long shopId)
    {
        return shopMapper.selectShopById(shopId);
    }

    /**
     * 查询网点列表列表
     * 
     * @param shop 网点列表
     * @return 网点列表
     */
    @Override
    public List<Shop> selectShopList(Shop shop)
    {
        return shopMapper.selectShopList(shop);
    }

    /**
     * 新增网点列表
     * 
     * @param shop 网点列表
     * @return 结果
     */
    @Override
    public int insertShop(Shop shop)
    {
        shop.setCreatedDate(Calendar.getInstance().getTime());
        shop.setLastUpdatedDate(Calendar.getInstance().getTime());
        shop.setIsDeleted(0L);
        return shopMapper.insertShop(shop);
    }

    /**
     * 修改网点列表
     * 
     * @param shop 网点列表
     * @return 结果
     */
    @Override
    public int updateShop(Shop shop)
    {
        return shopMapper.updateShop(shop);
    }

    /**
     * 删除网点列表对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteShopByIds(String ids)
    {
        return shopMapper.deleteShopByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除网点列表信息
     * 
     * @param shopId 网点列表ID
     * @return 结果
     */
    @Override
    public int deleteShopById(Long shopId)
    {
        return shopMapper.deleteShopById(shopId);
    }

    @Override
    public List<Shop> selectShopAll(Long userId) {
        return shopMapper.selectShopAll(userId);
    }
}
